package com.bluesky.light2.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.bluesky.light2.model.Category;

@Component("categoryService")
public class CategoryService {
	
	private HibernateTemplate hibernateTemplate;
	
	public void add(Category category) {
//System.out.println(hibernateTemplate);
		hibernateTemplate.save(category);
	}

	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}

	@Resource
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	public List<Category> getCategories() {
		return this.hibernateTemplate.find("from Category");
	}
}
